@extends('Admin.layout.layout')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>退货\款管理</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <form action="" method="GET">
                                {{csrf_field()}}
                            <div class="col-sm-12">
                                <div class="input-group fl mr10 mb5">
                                    <input name="change_code" value="{{array_get($search_params, 'change_code')}}" placeholder="请输入退单编号" class="input-sm form-control">
                                </div>
                                <div class="input-group fl mr10 mb5">
                                    <input name="shop_name" value="{{array_get($search_params, 'shop_name')}}" type="text" placeholder="请输入商铺名称" class="input-sm form-control">
                                </div>
                                <div class="input-group fl mr10 mb5">
                                    <input name="user_name" value="{{array_get($search_params, 'user_name')}}" type="text" placeholder="请输入买家名称" class="input-sm form-control">
                                </div>
                                <div class="input-group fl mr10 mb5">
                                    <input name="change_product" value="{{array_get($search_params, 'change_product')}}" type="text" placeholder="请输入商品名称" class="input-sm form-control">
                                </div>
                                <div class="input-group fl mr10 mb5">
                                    <input  name="order_code" value="{{array_get($search_params, 'order_code')}}" type="text" placeholder="请输入订单编号" class="input-sm form-control">
                                </div>
                                <div class="fl">
                                    <div class="input-group fl mr10 mb5">
                                        <input name="created_at[start]" value="{{array_get($search_params, 'created_at.start')}}" placeholder="开始日期" class="input-sm form-control layer-date" id="start">
                                    </div>
                                    <div class="input-group fl mr10 mb5"><p class="form-control-static">至</p></div>
                                    <div class="input-group fl mr10 mb5">
                                        <input name="created_at[end]" value="{{array_get($search_params, 'created_at.end')}}" placeholder="结束日期" class="input-sm form-control layer-date" id="end">
                                    </div>
                                </div>
                                <div class="fl">
                                    <div class="input-group fl mr10 mb5">
                                        <input name="change_money[start]" value="{{array_get($search_params, 'change_money.start')}}" type="text" placeholder="请输入退款金额" class="input-sm form-control">
                                    </div>
                                    <div class="input-group fl mr10 mb5"><p class="form-control-static">-</p></div>
                                    <div class="input-group fl mr10 mb5">
                                        <input  name="change_money[start]" value="{{array_get($search_params, 'change_money.start')}}" type="text" placeholder="请输入退款金额" class="input-sm form-control">
                                    </div>
                                </div>
                                <button type="submit" class="btn btn-sm btn-primary fl mb5">查询</button>
                            </div>
                                </form>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTable" id="editable">
                            <thead>
                                <tr>
                                    <th>退单编号</th>
                                    <th class="center">涉及订单</th>
                                    <th>退单类型</th>
                                    <th>买家</th>
                                    <th>店铺</th>
                                    <th>申请时间</th>
                                    <th style="width: 230px; ">涉及商品</th>
                                    <th style="width: 100px; ">申请原因</th>
                                    <th style="width: 230px; ">申请说明</th>
                                    <th>退款金额</th>
                                    <th class="center">状态</th>
                                </tr>
                            </thead>
                            <tbody>
                             @if(!empty($list))
                                 @foreach($list as $value)
                                     <tr>
                                         <td>{{array_get($value, 'change_code')}}</td>
                                         <td class="center">{{array_get($value, 'order_code')}}</td>
                                         <td>{{array_get($value, 'change_type_name')}}</td>
                                         <td>{{array_get($value, 'user_name')}}</td>
                                         <td>{{array_get($value, 'shop_name')}}</td>
                                         <td>{{array_get($value, 'created_at')}}</td>
                                         <td>
                                             @foreach($value['change_product'] as  $item)
                                             <p>{{array_get($item, 'product_name')}}</p>
                                             @endforeach
                                         </td>
                                         <td>{{array_get($value, 'resason')}}</td>
                                         <td>{{array_get($value, 'explain')}}</td>
                                         <td class="text-danger">￥{{array_get($value, 'change_money')}}</td>
                                         <td class="center">{{array_get($value, 'status_name')}}</td>
                                     </tr>
                                     @endforeach
                             @else
                                <tr class="no-records-found center"><td colspan="11">没有找到匹配的记录</td></tr>
                             @endif
                            </tbody>
                        </table>
                        <div class="row">
                            @include('Admin.common.paginate', ['page' => $page])
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="{{asset('js/plugins/layer/laydate/laydate.js')}}"></script>
    <script src="{{asset('js/plugins/layer/layer.min.js')}}"></script>

    <script>
        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: '2015-06-16 00:00:00', //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: '2015-06-16 00:00:00',
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);



    </script>
@endsection